package com.yl.utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.jeecg.common.system.vo.LoginUser;

/**
 * 用户上下文
 *
 * @author YL
 * @description:
 * @date 2024/10/12 16:03
 */
public class UserContext {
    private static final ThreadLocal<LoginUser> currentUser = new ThreadLocal<>();

    public static void setCurrentUser(LoginUser user) {
        currentUser.set(user);
    }

    public static LoginUser getCurrentUser() {
        return currentUser.get();
    }

    public static void clear() {
        currentUser.remove();
    }
}
